# -*- coding: utf-8 -*-
# @Time : 2023/12/10 16:00
# @Author : Lpb
# @File : pro5.py
# 5、编写一个函数，判断一个数是否为质数。#

def is_num(number):
    if number <=1:
        return False
    for i in range(2,number//2+1):
        if number % i == 0:
            return  False
    return True

num=29
if is_num(num):
    print(f"{num}是质数")
else:
    print(f"{num}不是质数")



# 定义判断质数的函数
# def is_prime(number):
#     if number <= 1:
#         return False
#     for i in range(2, int(number**0.5) + 1):
#         if number % i == 0:
#             return False
#     return True
#
# numbers_to_test = [3, 4, 11, 16, 23]
#
# for num in numbers_to_test:
#     print(f"{num} 是质数吗? {is_prime(num)}")
